.chat-page {
  font-family: "Arial", sans-serif;
  max-width: 3600px;
  margin: 0 auto;
  background-color: #f8f9fa;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.chat-container {
  width: 100%;
  max-width: 800px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h1 {
  font-size: 20px;
  color: #1a2a3a;
  margin: 0;
}

.clear-button {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-button:hover {
  background-color: #f3f4f6;
  color: #1a2a3a;
}

/* 聊天操作按钮 */
.chat-actions {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.clear-chat-button {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-chat-button:hover {
  background-color: #f3f4f6;
  color: #1a2a3a;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  text-align: center;
  margin: auto;
  max-width: 500px;
  padding: 20px;
}

.welcome-message h2 {
  font-size: 24px;
  color: #1a2a3a;
  margin-bottom: 12px;
}

.welcome-message p {
  color: #6b7280;
  margin-bottom: 24px;
}

.example-questions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.example-questions h3 {
  font-size: 16px;
  color: #4b5563;
  margin-bottom: 8px;
}

.example-question-button {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  font-size: 14px;
  color: #1a2a3a;
  cursor: pointer;
  transition: all 0.2s;
}

.example-question-button:hover {
  background-color: #e5e7eb;
  transform: translateY(-1px);
}

.message {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  background-color: #f3f4f6;
}

.message.assistant {
  background-color: #f0f7ff;
}

.message.system {
  background-color: #fff8f0;
}

.message.error {
  background-color: #fef2f2;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.message-sender {
  font-weight: 600;
  font-size: 14px;
  color: #1a2a3a;
}

.message-time {
  font-size: 12px;
  color: #6b7280;
}

.message-text {
  font-size: 15px;
  line-height: 1.5;
  color: #374151;
  white-space: pre-wrap;
  text-align: left;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: #6b7280;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.input-form {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background-color: white;
}

.input-container {
  display: flex;
  gap: 12px;
}

.message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
}

.message-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.message-input:disabled {
  background-color: #f3f4f6;
  cursor: not-allowed;
}

.send-button {
  padding: 0 20px;
  background-color: #1a2a3a;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.send-button:hover:not(:disabled) {
  background-color: #2c3e50;
  transform: translateY(-1px);
}

.send-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.error-message {
  color: #ef4444;
  font-size: 14px;
  margin-top: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.retry-button {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.retry-button:hover:not(:disabled) {
  background-color: #f3f4f6;
  color: #1a2a3a;
}

.retry-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 调整消息容器的padding，适配模态框 */
.chat-modal-body .messages-container {
  padding: 16px 20px;
}

.chat-modal-body .input-form {
  padding: 12px 20px;
}

/* 确保在模态框中聊天页面占满空间 */
.chat-modal-body .chat-page {
  min-height: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-page {
    padding: 0;
  }

  .chat-container {
    border-radius: 0;
    height: 100vh;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .message-text {
    font-size: 14px;
  }

  .input-form {
    padding: 12px 16px;
  }
}

/* 滚动条样式 */
.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
